import type { AppProps } from 'next/app';
import { useRouter } from 'next/router';
import React, { useLayoutEffect, useState } from 'react';
import Left from '@/components/layout/Left';
import Header from '@/components/layout/Header';
import Main from '@/components/layout/Main';
import Footer from '@/components/layout/Footer';
import Breadcrumb from '@/components/layout/Breadcrumb';
import { Layout, ConfigProvider } from 'antd';
import dayjs from 'dayjs';
import weekday from 'dayjs/plugin/weekday';
import localeData from 'dayjs/plugin/localeData';
import zhCN from 'antd/locale/zh_CN';
import 'dayjs/locale/zh-cn';
import { GlobalContextProvider, GlobalData } from '@/components/layout/GlobalContext';
import '../public/antd.min.css';
import '@/styles/globals.css';
import '@/styles/index.less';
import 'jsmind/style/jsmind.css';
import '@/styles/resetmind.css';

dayjs.extend(weekday);
dayjs.extend(localeData);

export default function App({ Component, pageProps }: AppProps) {
  const router = useRouter();

  return (
    <ConfigProvider locale={zhCN}>
      <GlobalContextProvider value={GlobalData}>
        {router.pathname === '/login' || router.pathname === '/dingUserInfo' ? (
          <Component {...pageProps} />
        ) : (
          <Layout style={{ minHeight: '100%', minWidth: '1250px' }} hasSider className="my-layout">
            <Left />
            <Layout>
              <Main>
                <Component {...pageProps} />
              </Main>
              {/* <Footer /> */}
            </Layout>
          </Layout>
        )}
      </GlobalContextProvider>
    </ConfigProvider>
  );
}
